package com.selfdriving.activity;

import java.util.ArrayList;
import java.util.List;
import net.tsz.afinal.annotation.view.ViewInject;
import com.selfdriving.R;
import com.selfdriving.adapter.DiaryDetailsAdapter;
import com.selfdriving.bean.DetailEntity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class StrategyDetailsActivity extends BaseActivity implements
		OnClickListener
{
	@ViewInject(id = R.id.strategy_list)
	ListView strategy_list;

	@ViewInject(id = R.id.topBack, click = "topBack")
	ImageView topBack;

	@ViewInject(id = R.id.topText)
	TextView topText;

	@ViewInject(id = R.id.topRight, click = "topRight")
	Button topRight;

	private List<DetailEntity> list;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.strategy_details);
		topText.setText("景点游记");
		topRight.setVisibility(View.GONE);
		list = new ArrayList<DetailEntity>();
		for (int i = 0; i < 10; i++)
		{
			switch (i)
			{
			case 0:
				DetailEntity detailEntity = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				detailEntity.flag = 1;
				list.add(detailEntity);
				break;
			case 1:
				DetailEntity detailEntity1 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity1);
				detailEntity1.flag = 0;
				break;
			case 2:
				DetailEntity detailEntity2 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity2);
				detailEntity2.flag = 1;
				break;
			case 3:
				DetailEntity detailEntity3 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity3);
				detailEntity3.flag = 0;
				break;
			case 4:
				DetailEntity detailEntity4 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity4);
				detailEntity4.flag = 1;
				break;
			case 5:
				DetailEntity detailEntity5 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity5);
				detailEntity5.flag = 0;
				break;
			case 6:
				DetailEntity detailEntity6 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity6);
				detailEntity6.flag = 0;
				break;
			case 7:
				DetailEntity detailEntity7 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity7);
				detailEntity7.flag = 1;
				break;
			case 8:
				DetailEntity detailEntity8 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity8);
				detailEntity8.flag = 0;
				break;
			case 9:
				DetailEntity detailEntity9 = new DetailEntity("Me",
						"2012-04-26", "Hello!", R.layout.list_say_me_item);
				list.add(detailEntity9);
				detailEntity9.flag = 1;
				break;
			default:
				break;
			}
		}
		strategy_list.setAdapter(new DiaryDetailsAdapter(mApplication, this,
				list, this));
	}

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
		case R.id.ivComment:
			Intent intent = new Intent(this, StrategyCommentActivity.class);
			startActivity(intent);
			break;

		default:
			break;
		}

	}

	@Override
	public void onBackPressed()
	{
		finish();
	}
}
